﻿// ***********************************************************************
// Assembly         : OSS.BIM
// Author           : tian_
// Created          : 09-04-2018
//
// Last Modified By : tian_
// Last Modified On : 09-04-2018
// ***********************************************************************
// <copyright file="ProjectLocationCmd.cs" company="北京智帆高科科技有限公司">
//     Copyright © 北京智帆高科科技有限公司 2018
// </copyright>
// <summary></summary>
// ***********************************************************************

using OSS.BIM.Model;
using OSS.BIM.SceneManage;
using OSS.BIM.Utility;
using ZFGK.Addins;
using ZFGK.osgEarth.UI;
using ZFGK.osgEarth.Utility;

namespace OSS.BIM.Commands.ProjcetCmds
{
    /// <summary>
    /// Class ProjectLocationCmd.
    /// </summary>
    /// <seealso cref="ZFGK.Addins.IExtendCommand" />
    public class ProjectLocationCmd : IExtendCommand
    {
        /// <summary>
        /// Executes the specified command data.
        /// </summary>
        /// <param name="cmdData">The command data.</param>
        /// <param name="message">The message.</param>
        /// <returns>CmdResult.</returns>
        public CmdResult Execute(ExtendCmdData cmdData, ref string message)
        {
            var osgEarthViewForm = cmdData.ViewForm as OsgEarthViewForm;
            if (osgEarthViewForm == null)
                return CmdResult.Failure;
            var osgEarthViewCtrl = osgEarthViewForm.OsgEarthViewCtrl;
            var osgEarthObj = osgEarthViewCtrl.OsgEarthObj;
            var actionUtility = osgEarthViewCtrl.ActionUtility;

            var project = cmdData.Tag as Project;
            if (project == null)
                return CmdResult.Cancel;

            var location = project.GetLocation();
            location.z += 1000;
            osgEarthObj.EarthManipulator.SetViewpoint(location);
            //osgEarthView.OutlineNode(airport.GroupName(), airport.AirportId.ToString());

            return CmdResult.Succeed;
        }
    }
}
